\(\int \frac {\cosh ^2(a+b x^2)}{x^2} \, dx\) [13]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 14, antiderivative size = 88 \[ \int \frac {\cosh ^2\left (a+b x^2\right )}{x^2} \, dx=-\frac {\cosh ^2\left (a+b x^2\right )}{x}-\frac {1}{2} \sqrt {b} e^{-2 a} \sqrt {\frac {\pi }{2}} \text {erf}\left (\sqrt {2} \sqrt {b} x\right )+\frac {1}{2} \sqrt {b} e^{2 a} \sqrt {\frac {\pi }{2}} \text {erfi}\left (\sqrt {2} \sqrt {b} x\right ) \]

[Out]

-cosh(b*x^2+a)^2/x-1/4*erf(x*2^(1/2)*b^(1/2))*b^(1/2)*2^(1/2)*Pi^(1/2)/exp(2*a)+1/4*exp(2*a)*erfi(x*2^(1/2)*b^
(1/2))*b^(1/2)*2^(1/2)*Pi^(1/2)

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {5439, 5736, 5422, 5406, 2235, 2236} \[ \int \frac {\cosh ^2\left (a+b x^2\right )}{x^2} \, dx=-\frac {1}{2} \sqrt {\frac {\pi }{2}} e^{-2 a} \sqrt {b} \text {erf}\left (\sqrt {2} \sqrt {b} x\right )+\frac {1}{2} \sqrt {\frac {\pi }{2}} e^{2 a} \sqrt {b} \text {erfi}\left (\sqrt {2} \sqrt {b} x\right )-\frac {\cosh ^2\left (a+b x^2\right )}{x} \]

[In]

Int[Cosh[a + b*x^2]^2/x^2,x]

[Out]

-(Cosh[a + b*x^2]^2/x) - (Sqrt[b]*Sqrt[Pi/2]*Erf[Sqrt[2]*Sqrt[b]*x])/(2*E^(2*a)) + (Sqrt[b]*E^(2*a)*Sqrt[Pi/2]
*Erfi[Sqrt[2]*Sqrt[b]*x])/2

Rule 2235

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^2), x_Symbol] :> Simp[F^a*Sqrt[Pi]*(Erfi[(c + d*x)*Rt[b*Log[F], 2
]]/(2*d*Rt[b*Log[F], 2])), x] /; FreeQ[{F, a, b, c, d}, x] && PosQ[b]

Rule 2236

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^2), x_Symbol] :> Simp[F^a*Sqrt[Pi]*(Erf[(c + d*x)*Rt[(-b)*Log[F],
 2]]/(2*d*Rt[(-b)*Log[F], 2])), x] /; FreeQ[{F, a, b, c, d}, x] && NegQ[b]

Rule 5406

Int[Sinh[(c_.) + (d_.)*(x_)^(n_)], x_Symbol] :> Dist[1/2, Int[E^(c + d*x^n), x], x] - Dist[1/2, Int[E^(-c - d*
x^n), x], x] /; FreeQ[{c, d}, x] && IGtQ[n, 1]

Rule 5422

Int[((a_.) + (b_.)*Sinh[u_])^(p_.), x_Symbol] :> Int[(a + b*Sinh[ExpandToSum[u, x]])^p, x] /; FreeQ[{a, b, p},
 x] && BinomialQ[u, x] &&  !BinomialMatchQ[u, x]

Rule 5439

Int[Cosh[(a_.) + (b_.)*(x_)^(n_)]^(p_)*(x_)^(m_.), x_Symbol] :> Simp[-Cosh[a + b*x^n]^p/((n - 1)*x^(n - 1)), x
] + Dist[b*n*(p/(n - 1)), Int[Cosh[a + b*x^n]^(p - 1)*Sinh[a + b*x^n], x], x] /; FreeQ[{a, b}, x] && IntegersQ
[n, p] && EqQ[m + n, 0] && GtQ[p, 1] && NeQ[n, 1]

Rule 5736

Int[Cosh[w_]^(p_.)*(u_.)*Sinh[v_]^(p_.), x_Symbol] :> Dist[1/2^p, Int[u*Sinh[2*v]^p, x], x] /; EqQ[w, v] && In
tegerQ[p]

Rubi steps \begin{align*} \text {integral}& = -\frac {\cosh ^2\left (a+b x^2\right )}{x}+(4 b) \int \cosh \left (a+b x^2\right ) \sinh \left (a+b x^2\right ) \, dx \\ & = -\frac {\cosh ^2\left (a+b x^2\right )}{x}+(2 b) \int \sinh \left (2 \left (a+b x^2\right )\right ) \, dx \\ & = -\frac {\cosh ^2\left (a+b x^2\right )}{x}+(2 b) \int \sinh \left (2 a+2 b x^2\right ) \, dx \\ & = -\frac {\cosh ^2\left (a+b x^2\right )}{x}-b \int e^{-2 a-2 b x^2} \, dx+b \int e^{2 a+2 b x^2} \, dx \\ & = -\frac {\cosh ^2\left (a+b x^2\right )}{x}-\frac {1}{2} \sqrt {b} e^{-2 a} \sqrt {\frac {\pi }{2}} \text {erf}\left (\sqrt {2} \sqrt {b} x\right )+\frac {1}{2} \sqrt {b} e^{2 a} \sqrt {\frac {\pi }{2}} \text {erfi}\left (\sqrt {2} \sqrt {b} x\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.18 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.07 \[ \int \frac {\cosh ^2\left (a+b x^2\right )}{x^2} \, dx=\frac {-4 \cosh ^2\left (a+b x^2\right )+\sqrt {b} \sqrt {2 \pi } x \text {erf}\left (\sqrt {2} \sqrt {b} x\right ) (-\cosh (2 a)+\sinh (2 a))+\sqrt {b} \sqrt {2 \pi } x \text {erfi}\left (\sqrt {2} \sqrt {b} x\right ) (\cosh (2 a)+\sinh (2 a))}{4 x} \]

[In]

Integrate[Cosh[a + b*x^2]^2/x^2,x]

[Out]

(-4*Cosh[a + b*x^2]^2 + Sqrt[b]*Sqrt[2*Pi]*x*Erf[Sqrt[2]*Sqrt[b]*x]*(-Cosh[2*a] + Sinh[2*a]) + Sqrt[b]*Sqrt[2*
Pi]*x*Erfi[Sqrt[2]*Sqrt[b]*x]*(Cosh[2*a] + Sinh[2*a]))/(4*x)

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 86, normalized size of antiderivative = 0.98

method result size
risch \(-\frac {1}{2 x}-\frac {{\mathrm e}^{-2 a} {\mathrm e}^{-2 b \,x^{2}}}{4 x}-\frac {{\mathrm e}^{-2 a} \sqrt {b}\, \sqrt {\pi }\, \sqrt {2}\, \operatorname {erf}\left (x \sqrt {2}\, \sqrt {b}\right )}{4}-\frac {{\mathrm e}^{2 a} {\mathrm e}^{2 b \,x^{2}}}{4 x}+\frac {{\mathrm e}^{2 a} b \sqrt {\pi }\, \operatorname {erf}\left (\sqrt {-2 b}\, x \right )}{2 \sqrt {-2 b}}\) \(86\)

[In]

int(cosh(b*x^2+a)^2/x^2,x,method=_RETURNVERBOSE)

[Out]

-1/2/x-1/4*exp(-2*a)/x*exp(-2*b*x^2)-1/4*exp(-2*a)*b^(1/2)*Pi^(1/2)*2^(1/2)*erf(x*2^(1/2)*b^(1/2))-1/4*exp(2*a
)/x*exp(2*b*x^2)+1/2*exp(2*a)*b*Pi^(1/2)/(-2*b)^(1/2)*erf((-2*b)^(1/2)*x)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 394 vs. \(2 (64) = 128\).

Time = 0.26 (sec) , antiderivative size = 394, normalized size of antiderivative = 4.48 \[ \int \frac {\cosh ^2\left (a+b x^2\right )}{x^2} \, dx=-\frac {\cosh \left (b x^{2} + a\right )^{4} + 4 \, \cosh \left (b x^{2} + a\right ) \sinh \left (b x^{2} + a\right )^{3} + \sinh \left (b x^{2} + a\right )^{4} + \sqrt {2} \sqrt {\pi } {\left (x \cosh \left (b x^{2} + a\right )^{2} \cosh \left (2 \, a\right ) + x \cosh \left (b x^{2} + a\right )^{2} \sinh \left (2 \, a\right ) + {\left (x \cosh \left (2 \, a\right ) + x \sinh \left (2 \, a\right )\right )} \sinh \left (b x^{2} + a\right )^{2} + 2 \, {\left (x \cosh \left (b x^{2} + a\right ) \cosh \left (2 \, a\right ) + x \cosh \left (b x^{2} + a\right ) \sinh \left (2 \, a\right )\right )} \sinh \left (b x^{2} + a\right )\right )} \sqrt {-b} \operatorname {erf}\left (\sqrt {2} \sqrt {-b} x\right ) + \sqrt {2} \sqrt {\pi } {\left (x \cosh \left (b x^{2} + a\right )^{2} \cosh \left (2 \, a\right ) - x \cosh \left (b x^{2} + a\right )^{2} \sinh \left (2 \, a\right ) + {\left (x \cosh \left (2 \, a\right ) - x \sinh \left (2 \, a\right )\right )} \sinh \left (b x^{2} + a\right )^{2} + 2 \, {\left (x \cosh \left (b x^{2} + a\right ) \cosh \left (2 \, a\right ) - x \cosh \left (b x^{2} + a\right ) \sinh \left (2 \, a\right )\right )} \sinh \left (b x^{2} + a\right )\right )} \sqrt {b} \operatorname {erf}\left (\sqrt {2} \sqrt {b} x\right ) + 2 \, {\left (3 \, \cosh \left (b x^{2} + a\right )^{2} + 1\right )} \sinh \left (b x^{2} + a\right )^{2} + 2 \, \cosh \left (b x^{2} + a\right )^{2} + 4 \, {\left (\cosh \left (b x^{2} + a\right )^{3} + \cosh \left (b x^{2} + a\right )\right )} \sinh \left (b x^{2} + a\right ) + 1}{4 \, {\left (x \cosh \left (b x^{2} + a\right )^{2} + 2 \, x \cosh \left (b x^{2} + a\right ) \sinh \left (b x^{2} + a\right ) + x \sinh \left (b x^{2} + a\right )^{2}\right )}} \]

[In]

integrate(cosh(b*x^2+a)^2/x^2,x, algorithm="fricas")

[Out]

-1/4*(cosh(b*x^2 + a)^4 + 4*cosh(b*x^2 + a)*sinh(b*x^2 + a)^3 + sinh(b*x^2 + a)^4 + sqrt(2)*sqrt(pi)*(x*cosh(b
*x^2 + a)^2*cosh(2*a) + x*cosh(b*x^2 + a)^2*sinh(2*a) + (x*cosh(2*a) + x*sinh(2*a))*sinh(b*x^2 + a)^2 + 2*(x*c
osh(b*x^2 + a)*cosh(2*a) + x*cosh(b*x^2 + a)*sinh(2*a))*sinh(b*x^2 + a))*sqrt(-b)*erf(sqrt(2)*sqrt(-b)*x) + sq
rt(2)*sqrt(pi)*(x*cosh(b*x^2 + a)^2*cosh(2*a) - x*cosh(b*x^2 + a)^2*sinh(2*a) + (x*cosh(2*a) - x*sinh(2*a))*si
nh(b*x^2 + a)^2 + 2*(x*cosh(b*x^2 + a)*cosh(2*a) - x*cosh(b*x^2 + a)*sinh(2*a))*sinh(b*x^2 + a))*sqrt(b)*erf(s
qrt(2)*sqrt(b)*x) + 2*(3*cosh(b*x^2 + a)^2 + 1)*sinh(b*x^2 + a)^2 + 2*cosh(b*x^2 + a)^2 + 4*(cosh(b*x^2 + a)^3
 + cosh(b*x^2 + a))*sinh(b*x^2 + a) + 1)/(x*cosh(b*x^2 + a)^2 + 2*x*cosh(b*x^2 + a)*sinh(b*x^2 + a) + x*sinh(b
*x^2 + a)^2)

Sympy [F]

\[ \int \frac {\cosh ^2\left (a+b x^2\right )}{x^2} \, dx=\int \frac {\cosh ^{2}{\left (a + b x^{2} \right )}}{x^{2}}\, dx \]

[In]

integrate(cosh(b*x**2+a)**2/x**2,x)

[Out]

Integral(cosh(a + b*x**2)**2/x**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 61, normalized size of antiderivative = 0.69 \[ \int \frac {\cosh ^2\left (a+b x^2\right )}{x^2} \, dx=-\frac {\sqrt {2} \sqrt {b x^{2}} e^{\left (-2 \, a\right )} \Gamma \left (-\frac {1}{2}, 2 \, b x^{2}\right )}{8 \, x} - \frac {\sqrt {2} \sqrt {-b x^{2}} e^{\left (2 \, a\right )} \Gamma \left (-\frac {1}{2}, -2 \, b x^{2}\right )}{8 \, x} - \frac {1}{2 \, x} \]

[In]

integrate(cosh(b*x^2+a)^2/x^2,x, algorithm="maxima")

[Out]

-1/8*sqrt(2)*sqrt(b*x^2)*e^(-2*a)*gamma(-1/2, 2*b*x^2)/x - 1/8*sqrt(2)*sqrt(-b*x^2)*e^(2*a)*gamma(-1/2, -2*b*x
^2)/x - 1/2/x

Giac [F]

\[ \int \frac {\cosh ^2\left (a+b x^2\right )}{x^2} \, dx=\int { \frac {\cosh \left (b x^{2} + a\right )^{2}}{x^{2}} \,d x } \]

[In]

integrate(cosh(b*x^2+a)^2/x^2,x, algorithm="giac")

[Out]

integrate(cosh(b*x^2 + a)^2/x^2, x)

Mupad [F(-1)]

Timed out. \[ \int \frac {\cosh ^2\left (a+b x^2\right )}{x^2} \, dx=\int \frac {{\mathrm {cosh}\left (b\,x^2+a\right )}^2}{x^2} \,d x \]

[In]

int(cosh(a + b*x^2)^2/x^2,x)

[Out]

int(cosh(a + b*x^2)^2/x^2, x)